参考 github 网址:https://github.com/mileszs/wicked_pdf
注:我的是 gem ‘rails’, ‘~> 4.2’,所以github官网上有些配置不需要配置
参考链接:
 https://reinteractive.com/posts/270-wickedpdf-and-custom-fonts-in-rails
 http://cnedelcu.blogspot.com/2015/04/wkhtmltopdf-chinese-character-support.html
 https://blog.ragnarson.com/2014/01/13/generating-pdfs-with-custom-fonts-using-wkhtmltopdf.html
1.添加 gem 到 Gemfile
  | 
  | 
4.layout: 'exams_pdf' 的配置, 修改的地方就是把 <%= stylesheet_link_tag 'exams' %>
  <%= javascript_include_tag 'exams' %> 改成 <%= wicked_pdf_stylesheet_link_tag 'exams' %>
  <%= wicked_pdf_javascript_include_tag 'exams' %>
  | 
  | 
5.以上四步就可以预览 pdf ;
6.这里加上 dpi: 72 可以加快生成速度,disposition: 'attachment' 这个是作为附件下载,而不是网页预览。
  | 
  | 
7.由于 wkhtmltopdf 是依赖系统的字体生成 pdf ,所以要在服务器上安装相应字体,不然到 uat 或者生产环境,没有字体的话,中文都会显示成小框框。